package com.day18me.Test;

import java.util.Set;
import java.util.TreeSet;

public class StudentTest {
    public static void main(String[] args) {
    // 添加到TreeSet集合中的元素必须具备比较大小的能力。如果不能进行比较，则添加到TreeSet集合中会抛出异常。
    Set set = new TreeSet();
    Student stu1 = new Student("刘备",50,"男");
    Student stu2 = new Student("貂蝉",25,"女");
    Student stu3 = new Student("大乔",20,"女");
    Student stu4 = new Student("关羽",49,"男");

    set.add(stu1);
    set.add(stu2);
    set.add(stu3);
    set.add(stu4);

    System.out.println(set);

}
}

